/**
 * 在苏部署、省属科研院所
 */
import { defineComponent } from 'vue';
import './style.scss';

export default defineComponent({
  name: 'IURank',
  props: {
    res: {
      type: Object,
      required: true,
      default: () => {
        return { data: [], total: 0 };
      },
    },
    onPageChange: Function,
  },
  render(props) {
    return (
      <div id="IURank">
        <header>在苏部署、省属科研院所</header>

        <ul>
          {props.res.data?.map?.((d: any, index: number) => {
            return (
              <li class={index % 2 ? '' : 'bg_another'}>
                <div>
                  <b> {index + 1}</b>
                </div>
                {d?.company_name}
              </li>
            );
          })}
        </ul>

        {/* 超过一屏幕 显示翻页 */}
        {this.res.total > 10 && (
          <footer>
            <el-pagination
              layout="prev, pager, next"
              total={this.res.total}
              page-size={10}
              onCurrentChange={props.onPageChange}
            ></el-pagination>
          </footer>
        )}
      </div>
    );
  },
});
